package com.alibaba.cloud.application.sms.factory;

import com.alibaba.cloud.application.enums.RejectStrategyEnum;
import com.alibaba.cloud.application.sms.strategy.SmsSendAnyMatchStrategy;
import com.alibaba.cloud.application.sms.strategy.SmsSendIgnoreStrategy;
import com.alibaba.cloud.application.sms.strategy.SmsSendRejectStrategy;
import com.alibaba.cloud.application.sms.strategy.SmsSendTotallyMatchStrategy;

/**
 * @author cruise
 * @description 拒绝策略工厂
 */
public class SmsSendRejectStrategyFactory {

    private static final SmsSendIgnoreStrategy IGNORE_STRATEGY = new SmsSendIgnoreStrategy();

    private static final SmsSendAnyMatchStrategy ANY_MATCH_STRATEGY = new SmsSendAnyMatchStrategy();

    private static final SmsSendTotallyMatchStrategy TOTALLY_MATCH_STRATEGY = new SmsSendTotallyMatchStrategy();

    public static SmsSendRejectStrategy getStrategy(RejectStrategyEnum strategyEnum) {
        return switch (strategyEnum) {
            case IGNORE -> IGNORE_STRATEGY;
            case ANY_MATCH -> ANY_MATCH_STRATEGY;
            case TOTALLY_MATCH -> TOTALLY_MATCH_STRATEGY;
            default -> throw new IllegalArgumentException("Illegal StrategyEnum Param");
        };
    }

}
